<?php
    echo $this->Html->css('jquery-ui-1.10.2.custom');
    echo $this->Html->css('ui.multiselect');
    echo $this->Html->script('jquery-1.9.1');
    echo $this->Html->script('jquery-ui-1.10.2.custom');
    echo $this->Html->script('ui.multiselect');
    echo $this->Html->script('instituicao');
?>
<form id="frmCadastroServicos" action="/siscel/instituicaoLabs/novoresptecnicos/<?php echo $id ?>" method="post">
    <input type="hidden" id="id" value="<?php echo $id ?>"/>
    <table style="width:900px;">
        <tr>
            <td colspan="2">
                <?php echo $this->Form->input('ResponsavelTecnicoLibExame.NO_RESPONSAVEL', array('type' => 'text', 'class'=>'campoAlfa', 'label' => 'Nome', 'id' => 'NO_RESPONSAVEL', 'maxlength'=>'60' )); ?>
            </td>
            <td>
                <?php echo $this->Form->input('ResponsavelTecnicoLibExame.CD_CBO', array('type' => 'select', 'class'=>'', 'label' => 'CBO', 'id' => 'CD_CBO', 'options'=> $arrCBO )); ?>
            </td>
        </tr>
        <tr>
            <td>
                <?php echo $this->Form->input('ResponsavelTecnicoLibExame.NU_CONSELHO', array('type' => 'text', 'class'=>'campoNumerico', 'label' => 'Conselho', 'id' => 'NU_CONSELHO', 'maxlength'=>'20' )); ?>
            </td>
            <td>
                <?php echo $this->Form->input('ResponsavelTecnicoLibExame.UF_CONSELHO', array('type' => 'select', 'class'=>'', 'label' => 'UF', 'id' => 'UF_CONSELHO', 'options'=> $arrUF )); ?>
            </td>
            <td>
                <?php echo $this->Form->input('ResponsavelTecnicoLibExame.SG_CONSELHO', array('type' => 'text', 'class'=>'campoAlfa', 'label' => 'SIGLA', 'id' => 'SG_CONSELHO', 'maxlength'=>'4' )); ?>
            </td>
        </tr>
    </table>
    <fieldset style="border: 1px solid #c5c5c5;">
        <legend>CNSUS</legend>
        <table width="100%" id="tbCnSus">
            <tr>
                <th>
                    <?php //echo $this->Form->input(null, array('type' => 'text', 'label' => 'CNSUS', 'id' => 'txtCNSUS', 'class' => 'campoAlfa' )); ?>
                    <div class="input text">
                        <label for="txtCNSUS">CNSUS</label>
                        <input type="text" class="campoAlfa" id="txtCNSUS">
                    </div>
                </th>
                <th>
                    <div class="input select">
                        <label for="selTipoCNSUS">Tipo</label>
                        <select class="" id="selTipoCNSUS">
                            <option value="">Selecione um item</option>
                            <option value="D">Definitivo</option>
                            <option value="P">Principal</option>
                        </select>
                    </div>
                </th>
                <th>
                    <?php echo $this->Html->image('/img/incluir.png', array('id' => 'btnAdicionar', 'onclick' => 'Instituicao.adicionarCNSUS();')) ?>
                </th>
            </tr>
            <tbody id="listaCNSUS">
                <?php
                if (isset($telefones)):
                    $index = 0;
                    $usuarios = $this->Session->read('usuario');
                    foreach ($telefones as $fone): ?>
                        <tr>
                            <td>
                                <?php echo $this->Form->input('', array('type' => 'hidden', 'label' => false, 'value' => $fone['CO_TELEFONE'])) ?>
                                <?php echo $this->Form->input('', array('type' => 'radio', 'label' => false, 'options' => array('S'=>''), 'checked' => (($fone['ST_PRINCIPAL'] === 'S') ? true : false) )) ?>
                                <?php echo $this->Siscel->tipoTelefone($fone['TP_TELEFONE']); ?>
                            </td>
                            <td>
                                <?php echo $this->Form->input('', array('type' => 'hidden', 'label' => false, 'value' => $fone['DDD_TELEFONE'])) ?><?php echo $fone['DDD_TELEFONE']; ?>
                                <?php echo $this->Form->input('', array('type' => 'hidden', 'label' => false, 'value' => $fone['NU_TELEFONE'])) ?><?php echo $fone['NU_TELEFONE']; ?>
                            </td>
                            <td>
                                <img src='/siscel/img/bt_apagar.gif'  id='btnExcluir<?php echo $index ?>' class='btnExcluir' onclick="excluiResponsavelTec()"/>
                            </td>
                        </tr>
                        <?php
                        $index++;
                    endforeach;
                endif;
                ?>
            </tbody>
        </table>
    </fieldset>
    <div class="submit">
        <input id="btNovoRespTec" type="button" value="Enviar"/>
    </div>
</form>
<script type="text/javascript">
$(function(){        
    Instituicao.init();
});
</script>